package xls_formats;

require Exporter;

#use xls_formats qw(get_xls_formats);

our @ISA = qw(Exporter);
our $VERSION = 1.00;
our @EXPORT = qw(get_xls_formats);



use strict;
use warnings;
use Carp;

#_________________________________________________________________________________________
	

#	get_xls_formats

#_________________________________________________________________________________________
sub get_xls_formats($\%)
{
	my ($workbook, $formats) = @_;

	# bold
	$formats->{bold} = $workbook->addformat();
	$formats->{bold}->set_bold();
	
	# blue and bold
	$formats->{blue_bold} = $workbook->addformat();
	$formats->{blue_bold}->set_bold();
	$formats->{blue_bold}->set_color('blue');
	
	# red and bold on yellow background
	$formats->{red_bold_yellow} = $workbook->addformat();
	$formats->{red_bold_yellow}->set_bold();
	$formats->{red_bold_yellow}->set_color('red');
	$formats->{red_bold_yellow}->set_bg_color('yellow');

	# red and bold on yellow background
	$formats->{red_bold_yellow_boxed} =
						$workbook->add_format(
											   border	=> 6,
											   valign	=> 'vcenter',
											   align 	=> 'center',
											   bold		=> 1,
											   bg_color	=> 'yellow',
											   color	=> 'red'
                                             );
	
	# purple, italic and bold on light green background
	$formats->{purple_bold_green} = $workbook->addformat();
	$formats->{purple_bold_green}->set_bold();
	$formats->{purple_bold_green}->set_italic();
	$formats->{purple_bold_green}->set_color('purple');
	$formats->{purple_bold_green}->set_bg_color(42);
	$formats->{purple_bold_green}->set_size(14);

	# three significant digits
	$formats->{double_digit} = $workbook->addformat();
	$formats->{double_digit}->set_num_format("0.00");

	# three significant digits
	$formats->{triple_digit} = $workbook->addformat();
	$formats->{triple_digit}->set_num_format("0.000");

	# percentage
	$formats->{percent} = $workbook->addformat();
	$formats->{percent}->set_num_format("0.0%");
	
	#comma
	$formats->{comma} = $workbook->addformat();
	$formats->{comma}->set_num_format('_-* #,##0_-;-* #,##0_-;_-* "-"??_-;_-@_-');
	
	# percentage
	$formats->{blue_bold_percent} = $workbook->addformat();
	$formats->{blue_bold_percent}->set_bold();
	$formats->{blue_bold_percent}->set_color('blue');
	$formats->{blue_bold_percent}->set_num_format("0%");

	# normal
	$formats->{black} = $workbook->addformat();
}



